﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using Common;
using System.Data.SqlClient;
using CNCSoft.EData;

namespace CNCSoft.ErpApps.TMS.Test
{
    public partial class frmCE : Form
    {
        private SqlConnection conn = new SqlConnection(GlobalVariable.WSInfo.ConnectionString);
        private DataSet ds;
        private string _madethi;
        private int _thoigianlambai;
        public frmCE(string madethi, string thoigianlambai)
        {
            InitializeComponent();
            this._madethi = madethi;
            this._thoigianlambai = Convert.ToInt32(thoigianlambai);
        }

        private void frmCE_Load(object sender, EventArgs e)
        {
            ds = new DataSet();

            slook_Enquiry.Enabled = true;
            LoadEnquiry();
            slook_Enquiry.Properties.DataSource = ds.Tables["TableEnquiry"];
            slook_Enquiry.Properties.DisplayMember = "FullName";
            slook_Enquiry.Properties.ValueMember = "EnquiryNumber";

            pnl_Main.VerticalScroll.Enabled = true;
            AddFile(String.Format("{0}.rtf", _madethi));

            txtTestDate.Enabled = false;
            btn_Start.Enabled = true;
            btn_Finish.Enabled = false;
            timerTest.Stop();
            txtTestDate.EditValue = DateTime.Now.ToShortDateString();

            //I/ Listening: Circle the correct letter.
            Label lbI = AddLabel(this.pnl_Main, "lbI", "I/ Listening: Circle the correct letter.", Color.Red, pnl_Listening.Bottom);

            //I.1
            AddListening1(1, 10, lbI.Location.Y);
        }

        #region "Coding"
        #region "Load De Thi"
        private void AddFile(string filename)
        {
            try
            {
                pnl_Listening.Visible = true;
                pnl_Listening.Width = 1024;
                pnl_Listening.Height = 800;
                rich_Listening.LoadFile(Environment.CurrentDirectory + "/" + filename);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddListening1(int begin, int end, int y)
        {
            try
            {
                y += 20;
                /*
                Label lbI1 = new Label();
                lbI1.Location = new Point(10, y);
                lbI1.AutoSize = true;
                lbI1.ForeColor = Color.Blue;
                lbI1.Name = "lbI1";
                lbI1.Text = "1/ Listen and circle the correct answers. Every item will be repeated twice in the track.";
                this.pnl_Main.Controls.Add(lbI1);
                */
                Label lbI1 = AddLabel(this.pnl_Main, "lbI1", "1/ Listen and circle the correct answers. Every item will be repeated twice in the track.", Color.Blue, y);
                
                for (int i = begin; i <= end; i++)
                {
                    string index = (i < 10) ? "0" + i : i.ToString();
                    Panel groupI1 = new Panel();
                    groupI1.Location = new Point(10, y + 20);
                    groupI1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                    groupI1.AutoSize = true;
                    groupI1.Name = "grpI1" + index;
                    this.pnl_Main.Controls.Add(groupI1);

                    Label lb = new Label();
                    lb.AutoSize = true;
                    lb.Location = new Point(10, 20);
                    lb.Text = i.ToString();
                    this.pnl_Main.Controls[groupI1.Name].Controls.Add(lb);

                    RadioButton rda = new RadioButton();
                    rda.Location = new Point(lb.Location.X + 30, lb.Location.Y);
                    rda.Text = "a.";
                    rda.Name = "aI1" + index;
                    rda.AutoSize = true;
                    this.pnl_Main.Controls[groupI1.Name].Controls.Add(rda);
                    rda.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    RadioButton rdb = new RadioButton();
                    rdb.Location = new Point(rda.Location.X + 100, rda.Location.Y);
                    rdb.Text = "b.";
                    rdb.Name = "bI1" + index;
                    rdb.AutoSize = true;
                    this.pnl_Main.Controls[groupI1.Name].Controls.Add(rdb);
                    rdb.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    RadioButton rdc = new RadioButton();
                    rdc.Location = new Point(rdb.Location.X + 100, rda.Location.Y - 1);
                    rdc.Text = "c.";
                    rdc.Name = "cI1" + index;
                    rdc.AutoSize = true;
                    this.pnl_Main.Controls[groupI1.Name].Controls.Add(rdc);
                    rdc.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    RadioButton rdd = new RadioButton();
                    rdd.Location = new Point(rdc.Location.X + 100, rda.Location.Y - 2);
                    rdd.Text = "d.";
                    rdd.Name = "dI1" + index;
                    rda.AutoSize = true;
                    this.pnl_Main.Controls[groupI1.Name].Controls.Add(rdd);
                    rdd.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    y += 20;
                }
                
                //y = AddABCD(this.pnl_Main, begin, end, y);

                //Add I.2
                AddListening2(1, 5, y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddListening2(int begin, int end, int y)
        {
            try
            {
                y += 50;
                /*
                Label lbI2 = new Label();
                lbI2.Location = new Point(10, y);
                lbI2.AutoSize = true;
                lbI2.ForeColor = Color.Blue;
                lbI2.Text = "2/ Listen to 5 conversations taking place at the party. Complete each conversation with an infinitive";
                lbI2.Name = "lbI2";
                this.pnl_Main.Controls.Add(lbI2);
                */
                Label lbI2 = AddLabel(this.pnl_Main, "lbI2", "2/ Listen to 5 conversations taking place at the party. Complete each conversation with an infinitive", Color.Blue, y); 

                for (int i = begin; i <= end; i++)
                {
                    string index = (i < 10) ? "0" + i : i.ToString();
                    Panel groupI2 = new Panel();
                    groupI2.Location = new Point(10, y + 20);
                    groupI2.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                    groupI2.AutoSize = true;
                    groupI2.Name = "grpI2" + index;
                    this.pnl_Main.Controls.Add(groupI2);

                    Label lb = new Label();
                    lb.AutoSize = true;
                    lb.Location = new Point(10, 20);
                    lb.Text = "Conversation" + i.ToString() + " (2 words)";
                    this.pnl_Main.Controls[groupI2.Name].Controls.Add(lb);

                    TextBox txt1 = new TextBox();
                    txt1.Location = new Point(lb.Location.X + 200, lb.Location.Y);
                    txt1.Width = 200;
                    txt1.Name = "txtI2" + index;
                    this.pnl_Main.Controls[groupI2.Name].Controls.Add(txt1);
                    txt1.TextChanged += new EventHandler(TextBox_TextChanged);

                    y += 20;
                }

                //Add I.3
                AddListening3(1, 5, y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddListening3(int begin, int end, int y)
        {
            try
            {
                y += 50;
                /*
                Label lbI3 = new Label();
                lbI3.Location = new Point(10, y);
                lbI3.AutoSize = true;
                lbI3.ForeColor = Color.Blue;
                lbI3.Text = "3/ Listen and complete the missing information";
                lbI3.Name = "lbI3";
                this.pnl_Main.Controls.Add(lbI3);
                */

                Label lbI3 = AddLabel(this.pnl_Main, "lbI3", "3/ Listen and complete the missing information", Color.Blue, y);
                
                for (int i = begin; i <= end; i++)
                {
                    string index = (i < 10) ? "0" + i : i.ToString();
                    Panel groupI3 = new Panel();
                    groupI3.Location = new Point(10, y + 20);
                    groupI3.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                    groupI3.AutoSize = true;
                    groupI3.Name = "grpI3" + index;
                    this.pnl_Main.Controls.Add(groupI3);

                    Label lb = new Label();
                    lb.AutoSize = true;
                    lb.Location = new Point(10, 20);
                    lb.Text = i.ToString();
                    this.pnl_Main.Controls[groupI3.Name].Controls.Add(lb);

                    if (i == 5)
                    {
                        TextBox txt1 = new TextBox();
                        txt1.Location = new Point(lb.Location.X + 20, lb.Location.Y);
                        txt1.Width = 300;
                        txt1.Name = "txtI3" + index;
                        this.pnl_Main.Controls[groupI3.Name].Controls.Add(txt1);
                        txt1.TextChanged += new EventHandler(TextBox_TextChanged);
                    }
                    else
                    {
                        TextBox txt1 = new TextBox();
                        txt1.Location = new Point(lb.Location.X + 20, lb.Location.Y);
                        txt1.Width = 200;
                        txt1.Name = "txtI3" + index;
                        this.pnl_Main.Controls[groupI3.Name].Controls.Add(txt1);
                        txt1.TextChanged += new EventHandler(TextBox_TextChanged);
                    }

                    y += 20;
                }

                //Add II Grammar
                /*
                Label lbII = new Label();
                lbII.Location = new Point(10, y + 50);
                lbII.AutoSize = true;
                lbII.Name = "lbII";
                lbII.ForeColor = Color.Red;
                lbII.Text = "II/ Grammar: Circle the correct letter.";
                this.pnl_Main.Controls.Add(lbII);
                */
                Label lbII = AddLabel(this.pnl_Main, "lbII", "II/ Grammar: Circle the correct letter.", Color.Red, y + 50);

                AddGrammar(1, 30, lbII.Location.Y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddGrammar(int begin, int end, int y)
        {
            try
            {
                y = AddABCD(this.pnl_Main, begin, end, y, "II0");

                //Add III
                Label lbIII = AddLabel(this.pnl_Main, "lbIII", "III/ Vocabulary", Color.Red, y + 50);
                AddVocabulary(31, 40, lbIII.Location.Y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddVocabulary(int begin, int end, int y)
        {
            try
            {
                y = AddABCD(this.pnl_Main, begin, end, y, "III0");

                //Add IV
                Label lbIV = AddLabel(this.pnl_Main, "lbIV", "IV/ PRONUNCIATION: Which word has a different sound? Choose the correct answer.", Color.Red, y + 50);
                AddPronunciation(41, 50, lbIV.Location.Y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddPronunciation(int begin, int end, int y)
        {
            try
            {
                y = AddABCD(this.pnl_Main, begin, end, y, "IV0");

                //Add V
                Label lbV = AddLabel(this.pnl_Main, "lbV", "V. READING SECTION", Color.Red, y + 50);
                //Add V1
                Label lbV1 = AddLabel(this.pnl_Main, "lbV1", "1/Directions: Read the passage and answer the questions below", Color.Blue, lbV.Location.Y + 20);
                AddReading1(51, 55, lbV1.Location.Y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddReading1(int begin, int end, int y)
        {
            try
            {
                y = AddABCD(this.pnl_Main, begin, end, y, "V0");

                //Add V2
                Label lbV2 = AddLabel(this.pnl_Main, "lbV2", "2/Directions: Read the passage and answer the questions below", Color.Blue, y + 50);
                AddReading2(56, 58, lbV2.Location.Y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddReading2(int begin, int end, int y)
        {
            try
            {
                y = AddABCD(this.pnl_Main, begin, end, y, "V0");

                //Add V3
                Label lbV3 = AddLabel(this.pnl_Main, "lbV3", "3/Directions: Read the passage and answer the questions below", Color.Blue, y + 50);
                AddReading3(59, 61, lbV3.Location.Y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddReading3(int begin, int end, int y)
        {
            try
            {
                y = AddABCD(this.pnl_Main, begin, end, y, "V0");

                //Add V4
                Label lbV4 = AddLabel(this.pnl_Main, "lbV4", "4/Directions: Read the passage and answer the questions below", Color.Blue, y + 50);
                AddReading4(62, 65, lbV4.Location.Y);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddReading4(int begin, int end, int y)
        {
            try
            {
                AddABCD(this.pnl_Main, begin, end, y, "V0");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        //Common method

        private int AddABCD(Panel panel, int begin, int end, int y, string chimuc)
        {
            try
            {
                for (int i = begin; i <= end; i++)
                {
                    string index = (i < 10) ? "0" + i : i.ToString();
                    Panel groupABCD = new Panel();
                    groupABCD.Location = new Point(10, y + 20);
                    groupABCD.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                    groupABCD.AutoSize = true;
                    groupABCD.Name = "grp" + chimuc + index;
                    panel.Controls.Add(groupABCD);

                    Label lb = new Label();
                    lb.AutoSize = true;
                    lb.Location = new Point(10, 20);
                    lb.Text = i.ToString();
                    panel.Controls[groupABCD.Name].Controls.Add(lb);

                    RadioButton rda = new RadioButton();
                    rda.Location = new Point(lb.Location.X + 30, lb.Location.Y);
                    rda.Text = "a.";
                    rda.Name = "a" + chimuc + index;
                    rda.AutoSize = true;
                    panel.Controls[groupABCD.Name].Controls.Add(rda);
                    rda.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    RadioButton rdb = new RadioButton();
                    rdb.Location = new Point(rda.Location.X + 100, rda.Location.Y);
                    rdb.Text = "b.";
                    rdb.Name = "b" + chimuc + index;
                    rdb.AutoSize = true;
                    panel.Controls[groupABCD.Name].Controls.Add(rdb);
                    rdb.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    RadioButton rdc = new RadioButton();
                    rdc.Location = new Point(rdb.Location.X + 100, rda.Location.Y - 1);
                    rdc.Text = "c.";
                    rdc.Name = "c" + chimuc + index;
                    rdc.AutoSize = true;
                    panel.Controls[groupABCD.Name].Controls.Add(rdc);
                    rdc.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    RadioButton rdd = new RadioButton();
                    rdd.Location = new Point(rdc.Location.X + 100, rda.Location.Y - 2);
                    rdd.Text = "d.";
                    rdd.Name = "d" + chimuc + index;
                    rda.AutoSize = true;
                    panel.Controls[groupABCD.Name].Controls.Add(rdd);
                    rdd.CheckedChanged += new System.EventHandler(RadioButtonABCD_CheckedChanged);

                    y += 20;
                }
                return y;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return 0;
            }
        }

        private Label AddLabel(Panel panel, string name, string text, Color color, int y)
        {
            try
            {
                Label lb = new Label();
                lb.Location = new Point(10, y);
                lb.AutoSize = true;
                lb.Name = name;
                lb.ForeColor = color;
                lb.Text = text;
                panel.Controls.Add(lb);
                return lb;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }
        }
        #endregion

        #region "Load Other"
        private void LoadEnquiry()
        {
            try
            {
                string sql = String.Format(@"select EnquiryNumber, (Holot + ' ' + Ten) as 'FullName'
                                            from Enquiry");
                SqlDataAdapter da = new SqlDataAdapter(sql, GlobalVariable.WSInfo.ConnectionString);
                da.Fill(ds, "TableEnquiry");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void LoadMusic(string filename)
        {
            try
            {
                axWindowsMediaPlayer1.URL = Environment.CurrentDirectory + "/" + filename;
                axWindowsMediaPlayer1.Ctlcontrols.play();
                axWindowsMediaPlayer1.Ctlenabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void LoadTime()
        {
            try
            {
                progressBarTime.Maximum = _thoigianlambai;
                progressBarTime.Value = progressBarTime.Maximum;

                lblTimeLeft.Text = "Time left (minutes): " + progressBarTime.Value.ToString();

                timerTest.Interval = 1000 * _thoigianlambai;
                timerTest.Start();

                btn_Start.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void InsertTestResult(string enqnum, DateTime testdate, int listening, int reading, string madethi)
        {
            try
            {
                //MessageBox.Show(testdate.ToString());
                SQLHelper.ExecuteNonQuery(GlobalVariable.WSInfo.ConnectionString,
                                        String.Format(@"usp_InsertTestResult @enquirynumber = '{0}', @testdate = '{1}', @scoredirection = {2}, @scorelistening = {3}, 
                                                        @scorereading = {4}, @scorewriting = {5}, @madethi = '{6}', @ketqua = '{7}', @recommendedclass = '{8}'",
                                                        enqnum, testdate, 0, listening, reading, 0, madethi, "", ""));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion

        #region "Get Value"
        private void RadioButtonABCD_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                RadioButton r = ((RadioButton)sender);
                string indexandstt = r.Name.ToString().Substring(1);
                string ndung = (r.Name.ToString().Substring(0, 1) == null) ? "" : r.Name.ToString().Substring(0, 1);
                this.pnl_Main.Controls["grp" + indexandstt].Tag = ndung;
                //MessageBox.Show(indexandstt + "/" + this.pnl_Main.Controls["grp" + indexandstt].Tag.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void TextBox_TextChanged(object sender, EventArgs e)
        {
            try
            {
                TextBox t = (TextBox)sender;
                string indexandstt = t.Name.Substring(3);
                string ndung = (t.Text == null) ? "" : t.Text;
                this.pnl_Main.Controls["grp" + indexandstt].Tag = ndung;
                //MessageBox.Show(indexandstt + "/" + this.pnl_Main.Controls["grp" + indexandstt].Tag.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion

        #region "Get Result"
        private SqlDataReader GetResult(string chimuc)
        {
            try
            {
                SqlDataReader rd = SQLHelper.ExecuteReader(GlobalVariable.WSInfo.ConnectionString,
                                    String.Format(@"declare @chimuc varchar(10)
                                    set @chimuc = '{0}'
                                    select Substring(MaCauHoi, 4, LEN(MaCauHoi) - 3) as 'MaCauHoi', lower(DapAn) as 'DapAn'
                                    from TEST_Question 
                                    where MaDeThi = '{1}' 
                                    and SUBSTRING(MaCauHoi, 4, LEN(@chimuc)) = @chimuc", chimuc, _madethi));
                return rd;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }
        }
        #endregion

        #region "Mathing"
        private void Mathing()
        {
            try
            {
                SqlDataReader rd;
                int correctI, correctI1, correctI2, correctI3, correctII, correctIII, correctIV, correctV;
                correctI1 = correctI2 = correctI3 = correctII = correctIII = correctIV = correctV = 0;
                //I.1 Listen and circle the correct answers. Every item will be repeated twice in the track.
                rd = GetResult("I1");
                correctI1 = CountCorrect(rd);

                //I.2 Listen to 5 conversations taking place at the party. Complete each conversation with an infinitive
                rd = GetResult("I2");
                correctI2 = CountCorrect(rd);

                //I.3 Listen and complete the missing information
                rd = GetResult("I3");
                correctI3 = CountCorrect(rd);

                //II. Grammar
                rd = GetResult("II0");
                correctII = CountCorrect(rd);

                //III. Vocaublary
                rd = GetResult("III0");
                correctIII = CountCorrect(rd);

                //IV. Pronunciation
                rd = GetResult("IV0");
                correctIV = CountCorrect(rd);

                //V. Reading
                rd = GetResult("V0");
                correctV = CountCorrect(rd);

                correctI = correctI1 + correctI2 + correctI3;
                lblResultListening.Text = "Listening: " + correctI;
                lblResultGrammar.Text = "Grammar: " + correctII;
                lblResultVocabulary.Text = "Vocabulary: " + correctIII;
                lblResultPronunciation.Text = "Pronunciation: " + correctIV;
                lblResultReading.Text = "Reading: " + correctV;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private int CountCorrect(SqlDataReader rd)
        {
            try
            {
                int i = 0;
                while (rd.Read())
                {
                    if (this.pnl_Main.Controls["grp" + rd["MaCauHoi"].ToString()].Tag != null)
                    {
                        if (this.pnl_Main.Controls["grp" + rd["MaCauHoi"].ToString()].Tag.ToString() == rd["DapAn"].ToString().Trim())
                            i++;
                    }
                }
                return i;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return 0;
            }
        }
        #endregion

        private void btn_Start_Click(object sender, EventArgs e)
        {
            if (slook_Enquiry.EditValue.ToString() != "" && slook_Enquiry.EditValue != null)
            {
                this.btn_Start.Enabled = false;
                slook_Enquiry.Enabled = false;
                this.pnl_Main.Enabled = true;
                this.btn_Finish.Enabled = true;
                LoadTime();
                LoadMusic(String.Format("{0}.mp3", _madethi));
            }
            else
            {
                MessageBox.Show("Bạn chưa chọn tên.");
            }
        }

        private void btn_Finish_Click(object sender, EventArgs e)
        {
            try
            {
                btn_Finish.Enabled = false;
                slook_Enquiry.Enabled = false;
                axWindowsMediaPlayer1.Ctlcontrols.stop();
                timerTest.Stop();
                MessageBox.Show("Finish");
                Mathing();
                int i = Convert.ToInt32((lblResultGrammar.Text.Split(':'))[1].Trim()) + Convert.ToInt32((lblResultVocabulary.Text.Split(':'))[1].Trim())
                        + Convert.ToInt32((lblResultPronunciation.Text.Split(':'))[1].Trim()) + Convert.ToInt32((lblResultReading.Text.Split(':'))[1].Trim());
                InsertTestResult(slook_Enquiry.EditValue.ToString(), Convert.ToDateTime(txtTestDate.EditValue.ToString()), Convert.ToInt32((lblResultListening.Text.Split(':'))[1].Trim()),
                                i, _madethi);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void timerTest_Tick(object sender, EventArgs e)
        {
            try
            {
                if (progressBarTime.Value == 0)
                {
                    timerTest.Stop();
                    btn_Finish_Click(sender, e);
                    MessageBox.Show("Test time has expired !", "Sorry");
                    return;
                }
                progressBarTime.Value--;
                lblTimeLeft.Text = "Time left (minutes): " + progressBarTime.Value.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void frmCE_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (btn_Finish.Enabled)
            {
                MessageBox.Show("Click <Finish button> to finish the test before closing form", "Placement Test", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                e.Cancel = true;
            }
        }
        #endregion
    }
}
